package com.xm.xmapp;

import android.content.Intent;
import android.os.Bundle;

import com.xm.xmapp.base.BaseActivity;
import com.xm.xmapp.dialog.JpushTipDialog;
import com.xm.xmapp.dialog.JpushTipDialog.Data;
import com.xm.xmapp.dialog.JpushTipDialog.JpushDialogOnclick;
import com.xm.xmapp.response.bean.JpushNotifactionResponse;

public class DialogActivity extends BaseActivity {
	JpushNotifactionResponse bean;
	JpushTipDialog tipDialog;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_dialog);

	}

	@Override
	public void initView() {

	}

	@Override
	public void initData() {
		bean = (JpushNotifactionResponse) getIntent().getSerializableExtra("bean");
		tipDialog = new JpushTipDialog(this, bean);
		tipDialog.setmJpushDialogOnclick(new JpushDialogOnclick() {

			@Override
			public void go(Data data) {

				intent = new Intent(getApplicationContext(), JpushDetailsActivity.class);
				intent.putExtra("id", bean.messageId);
				startActivity(intent);
				finish();
			}

			@Override
			public void cacle() {
				finish();
			}
		});
		tipDialog.show();
	}

	@Override
	public void initEvent() {

	}

	@Override
	protected void onDestroy() {

		super.onDestroy();
		if (tipDialog != null)
			tipDialog.dismiss();
	}

	@Override
	public void onBackPressed() {
		super.onBackPressed();
		if (tipDialog != null)
			tipDialog.dismiss();
		finish();
	}
}
